/**
 * @author mangani(조민석)
 */

package com.example.kakaofragment;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;

public class SplashActivity extends Activity {
	//로그 태그변수
	private static final String TAG = "SplashActivity";
	private Context ctx;
	private ImageView splash;

	protected void onCreate(Bundle savedInstanceState) {
		//타이틀바 없애기
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		super.onCreate(savedInstanceState);
		//세로고정
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		setContentView(R.layout.splash);
		ctx = this;

		Animation animation = new AlphaAnimation(0.0f, 1.0f);
		animation.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation animation) {
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				Handler handler = new Handler();
				//Log.e("Splash", "this activity error?1");
				handler.postDelayed(new Runnable() {

					@Override
					public void run() {

							Intent intent = new Intent();
							intent.setClass(ctx, MainActivity.class);
							startActivity(intent);
							SplashActivity.this.finish();
							overridePendingTransition(0, 0);

					}
				}, 2000);

			}
		});

		animation.setDuration(200);
		splash = (ImageView) findViewById(R.id.splash);

		splash.startAnimation(animation);
	}
}
